#ifndef __MESH_H__
#define __MESH_H__

#include <vector>
#include <iostream>
#include <fstream>
#include <glad/glad.h>

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "utils.h"
#include "shader.h"

using namespace std;

struct Vertex {
    glm::vec3 position;
    glm::vec3 normal;
    glm::vec2 texCoord;
};

struct Texture {
    unsigned int id;
    char type[128];
    char path[128];
};

struct Face {
    int length;
    unsigned int v1[3];
    unsigned int v2[3];
    unsigned int v3[3];
    unsigned int v4[3];
};

struct Material {
    char newmtl[128];
    char map_Kd[128];
    char map_Bump[128];
};

class Mesh {
    public:
        vector<Vertex> vertices;
        vector<unsigned int> indices;
        vector<Texture> textures;
        Mesh(vector<Vertex> vertices, vector<unsigned int> indices, vector<Texture> textures) {
            this->vertices = vertices;
            this->indices = indices;
            this->textures = textures;
            init();
        }
        void draw(unsigned int shaderProgram);
    private:
        unsigned int vao, vbo, ebo;
        void init();
};

#endif
